<%@LANGUAGE="VBSCRIPT" Codepage = 65001%>
<% Option Explicit %>

<!--#include file="includes/cb_adovbs_sys.inc"-->
<!--#include file="includes/header_sys.asp"-->
<!--#include file="includes/generally_sys.asp"-->
<!--#include file="includes/translate.asp"-->
<!--#include file="includes/gwm_user_menu_dhx.asp"-->

<%
'On Error Resume Next
'Codepage einstellen
Session.CodePage = 65001'Unicode, 8-bit encoding
Response.CharSet = "utf-8"

'Sprache -----------------------------------------------------------------
Dim i_lng
i_lng = Request("lng")
If IsEmpty(i_lng) or IsNull(i_lng) Then
	i_lng = Session("ses_i_language") 
end if
Session("ses_i_language")=i_lng'0=keine auswahl 1=german 2=english
'--------------------------------------------------------------------------

'Dim str_sitename
'str_sitename = request.servervariables("SCRIPT_NAME")
'Response.Write(str_sitename & "<br>")

Dim ses_path_sys
ses_path_sys = Session("ses_path_sys")

Dim i_authority
Dim i_modul	
Dim isx
Dim lng_fk_user_group_ses  
Dim lng_fk_User_ID_admin_ses
Dim lng_fk_User_ID_org_ses
Dim lng_fk_User_ID_trainer_ses
Dim lng_fk_encounter_group_ses

Dim str_trenzeichen_info'das trennzeichen beim infotext rechts oben

'wie oft wurde angemeldet
'zählt mit wie oft mit einer session (browserfenster) angemeldet wurde
Dim i_session
i_session = Session("ses_i")
Session("ses_i") = i_session + 1
i_session = Session("ses_i")

Dim str_title
str_title = Session("ses_title")
'2009 05 01 Datumstrennzeichen
Const Con_date_trenn = "-"
'-------------------------------------------------------------------
'2009 05 01 Modul für interne Berechtigung
'Session("ses_i_modul_10")=0'10-useradmin-Vollzugriff
Dim i_authority_useradmin
i_authority_useradmin = Session("ses_i_modul_01")
'-------------------------------------------------------------------
'log var - wichtig
Dim iu 'user id as long int
Dim ig 'usergroup as long int

Dim str_user_id
Dim str_pw

Dim rs
Dim rs_tmp
Dim objConn
Dim queryStr
Dim dt_pw_available_to
Dim lng_k_User_ID
Dim i_pos
Dim i
Dim str_logfree 'ob userid und pw ok sind - A1 > nein - A0 >> ok
Dim lng_fk_head_organization
Dim i_type
Dim lng_fk_organization
Dim lng_fk_trainer
Dim lng_fk_athlete
Dim i_dummy_head
Dim i_dummy_sub
Dim str_user_id_short

Dim id_head_org
Dim i_usergroup
Dim i_report_01'admin_overview_status.asp
Dim i_report_02'admin_overview_id.asp (mit Login)

Set objConn = Server.CreateObject("ADODB.Connection")
objConn.open strComplete_sys 

'2012 03 04 variable die die Function fc_value_string umschaltet (für dyn. Übersetzung)
'1= der Text wird angezeigt
'2= der Variablenname wird angezeigt
'x_translate_function
Dim sql_tmp
Dim rst_tmp
sql_tmp = "SELECT lng_k_function FROM x_translate_function WHERE id_k_lng = '1'"
'Response.Write(SQL)
'Response.End()

Set rst_tmp = Server.CreateObject("ADODB.Recordset")
rst_tmp.Open sql_tmp, objConn, adOpenStatic, adLockReadOnly   
    If Not rst_tmp.EOF Then
        Session("ses_i_fc_value_string")= rst_tmp.Fields("lng_k_function").Value
    End if
	rst_tmp.Close
set rst_tmp = Nothing

If IsNull(Session("ses_i_fc_value_string")) or IsEmpty(Session("ses_i_fc_value_string")) or Len(Session("ses_i_fc_value_string"))=0 Then
	Session("ses_i_fc_value_string") = 1
end if

'username und password von der eingabe
str_user_id = Request("T1")
str_pw = Request("T2")

'falls die log var schon leer ist
'iu = Request("iu")
'ig = Request("ig")
'2009 05 01 session log
iu = Session("ses_iu")
ig = Session("ses_ig")
		
If iu = "" or iu = 0 Then'die echte log var wird überprüft
	iu = 0
	ig = 0
end if


'falls man noch nicht eingeloggt ist
If iu = 0 and ig = 0 Then

'überpürft es ob ein fingierter zugrifff ist------------------------------------------------------------------------------------------------------
'zum Beispiel
'Benutzername  ' OR '1'='1
'Passwort  ' OR '1'='1

'hochkomma
'check username
i_pos =  0
i_pos = Instr(str_user_id, "'")

If Cint(i_pos) > 0 then
	call showMessage(fc_value_string(Session("ses_i_language"), "var_glob_txt_1004"))'old Con_Msg_error >> "Bad accesses!"
    Response.Write ("<SCRIPT LANGUAGE='Javascript'>this.location.href='index.asp';</SCRIPT>") 
end if

'check pw
i_pos =  0
i_pos = Instr(str_pw, "'")

If Cint(i_pos) >  0 then
	call showMessage(fc_value_string(Session("ses_i_language"), "var_glob_txt_1004"))'old Con_Msg_error >> "Bad accesses!"
    Response.Write ("<SCRIPT LANGUAGE='Javascript'>this.location.href='index.asp';</SCRIPT>") 
end if

'istzeichen
'check username
i_pos =  0
i_pos = Instr(str_user_id, "=")

If Cint(i_pos) > 0 then
	call showMessage(fc_value_string(Session("ses_i_language"), "var_glob_txt_1004"))'old Con_Msg_error >> "Bad accesses!"
    Response.Write ("<SCRIPT LANGUAGE='Javascript'>this.location.href='index.asp';</SCRIPT>") 
end if
'check pw
i_pos =  0
i_pos = Instr(str_pw, "=")

If Cint(i_pos) > 0 then
	call showMessage(fc_value_string(Session("ses_i_language"), "var_glob_txt_1004"))'old Con_Msg_error >> "Bad accesses!"
   	Response.Write ("<SCRIPT LANGUAGE='Javascript'>this.location.href='index.asp';</SCRIPT>") 
end if

Session("ses_Username_log")=str_user_id'eingabe login
Session("ses_Password_log")=str_pw'eingabe login

str_user_id_short = Left(str_user_id, 3)

Dim str_User_Last_Name
Dim str_User_First_Name
Dim str_head_organization
Dim str_sub_organization
Dim str_trainer

Dim i_fk_measured_system

Dim str_text_trennzeichen'zb: |
str_text_trennzeichen = fc_value_string(Session("ses_i_language"), "var_glob_txt_1009")'"New Login"

'NEU 2010 05 01 ohne überprüfung mit emaillink
'------------------------------------------------------------------------------------------------------------------------------------------
'------------------------------------------------------------------------------------------------------------------------------------------
'first login-------------------------------------------------------------------------------------------------------------------------------
'ueberprueft die eingabe ------------------------------------------------------------------------------------------------------------------
'20090927
'änderung - es gibt nur einen key für alle drei ebenen
'der user entscheidet wohin er will
'Session("ses_first_log")="E0-"
'Session("ses_first_log_02")="EX-"

'2009 11 06 manche user verwenden auch die systemzugangsdaten als ihr eigene user id und pw ------------
'jetzt wird dies überprüft
Dim i_user
Dim i_link_activate

i_link_activate = 0'default
i_user = 0 'default >> es wurde eine andere user id ohne "EO oder EX" eingetragen

'man kann auch mit den systemzugangsdaten seine user id und pw eingeben

'#1 zuerst muss überpürft werden falls der user ein EO- oder EX-... verwendet ob dieser nicht schon ein bestehender user
'er kann ja zb nur mit dem E0-oder EX-.... und einen anderen PW arbeiten
'queryStr = "SELECT lng_k_User_ID FROM tbl_0501_user WHERE str_User_id='" & str_user_id & "' AND str_pw='" & str_pw & "' AND i_fk_status='1's"

'2010 01 19 -Änderung wegen fehler beim login
queryStr = "SELECT tbl_0501_user.lng_k_User_ID, tbl_0101_master_id.i_link_activate " & _
"FROM tbl_0501_user, tbl_0101_master_id " & _
"WHERE tbl_0501_user.lng_k_User_ID = tbl_0101_master_id.lng_fk_User_ID " & _
"AND tbl_0501_user.str_User_id='" & str_user_id & "' " & _
"AND tbl_0501_user.str_pw='" & str_pw & "' " & _
"AND tbl_0501_user.i_fk_status='1'"

		Set rs = Server.CreateObject("ADODB.RecordSet")
		rs.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
		If Not rs.EOF Then	
			i_user = rs.Fields("lng_k_User_ID")
			i_link_activate = rs.Fields("i_link_activate")
		end if	
		rs.close
		set rs = Nothing 
		
		'2011 01 19
		'wenn der user sein profil ausgefüllt hat aber trotzdem noch nicht aktiviert ist
		If i_user > 0 and i_link_activate = 0 Then'0 >> link noch nicht aktiviert 1>> link aktiviert
			'NEU 2010 05 01 aktiviert den USER (auch ohne emaillink)
			queryStr = "UPDATE tbl_0101_master_id SET " & _
			"i_link_activate = '" & 1 & "'" & _
			" WHERE lng_fk_User_ID ='" & i_user & "'"
			objConn.Execute queryStr
			'call showMessage("Hallo - das ist ein Test!")
		end if

'#2
'jetzt wird nur noch überprüft ob dieser acount auch aktiviert ist	
	If i_user = 0 Then	
	
		queryStr = "SELECT i_link_activate FROM tbl_0101_master_id WHERE str_master_id = '" & str_pw & "' AND str_log_id = '" & str_user_id & "'"
'		Response.Write(queryStr & "<br>")
'		Response.End()		
		Set rs = Server.CreateObject("ADODB.RecordSet")
		
		rs.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
		If Not rs.EOF Then	
			i_link_activate = rs.Fields("i_link_activate")
		end if	
			rs.close
		set rs = Nothing 

	end if
	
'-------------------------------------------------------------------------------------------------------
'Session("ses_first_log") = E0
'Session("ses_first_log_02") = EX
If str_user_id_short = Session("ses_first_log") and Cint(i_link_activate) = 0 or str_user_id_short = Session("ses_first_log_02") and Cint(i_link_activate) = 0 Then  
		
		i = 0 'default >> noch nicht abgelaufen
		
		queryStr = "SELECT COUNT(1) AS i FROM tbl_0101_master_id WHERE str_master_id = '" & str_pw & "' AND str_log_id = '" & str_user_id & "' AND i_log = 0"
		Set rs = Server.CreateObject("ADODB.RecordSet")
		rs.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
			i = rs.Fields("i")
			rs.close
		set rs = Nothing 
	
	'#1a anmeldung mit einer first log id
	If Cint(i) = 1 Then

		'holt jetzt die id der referenz org id
		queryStr = "SELECT lng_fk_head_organization, lng_fk_organization, lng_fk_trainer, i_type, lng_fk_athlete " & _
		"FROM tbl_0101_master_id WHERE str_master_id = '" & str_pw & "' AND str_log_id = '" & str_user_id & "' AND i_log = 0"

'Response.Write(queryStr & "<br>")
'Response.End()	

		Set rs = Server.CreateObject("ADODB.RecordSet")
		rs.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
		If Not rs.EOF Then
			lng_fk_head_organization = rs.Fields("lng_fk_head_organization").Value
			lng_fk_organization = rs.Fields("lng_fk_organization").Value
			lng_fk_trainer = rs.Fields("lng_fk_trainer").Value
			lng_fk_athlete = rs.Fields("lng_fk_athlete").Value
			i_type = rs.Fields("i_type").Value
		end if
		rs.Close 
		set rs = Nothing 
		
'---------------------------------------------------------------------------------------------------------------------------------------------------------------
		'überprüfung ob diese head-org eine dummy head org ist
		'wenn es für den angelegten user eine dummy head org (Non Commercial) darüber gibt >>> = 1	
		Session("ses_i_dummy_head_org")=0
		Session("ses_i_dummy_sub_org")=0

		'Login als head org admin oder als ein user der sich beim auswählen für eine sub org entscheidet
		If lng_fk_head_organization > 0 Then
			queryStr = "SELECT i_dummy FROM tbl_0190_head_organization WHERE lng_k_head_organization = '" & lng_fk_head_organization & "'"
			
			Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
			rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
			If Not rs_tmp.EOF Then
				i_dummy_head = rs_tmp.Fields("i_dummy").Value
			end if
			rs_tmp.Close 
			set rs_tmp = Nothing
			
			If i_dummy_head > 0 Then
				Session("ses_i_dummy_head_org")=1'= ein dummy
			end if
			
			'holt jetzt die <sub org id> falls die head org eine dummy ist
			If i_dummy_head > 0 Then
				queryStr = "SELECT lng_k_organization, i_dummy FROM tbl_0201_organization " & _
				"WHERE lng_fk_head_organization = '" & lng_fk_head_organization & "' AND i_dummy = '1'"
				Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
				rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
				If Not rs_tmp.EOF Then
					i_dummy_head = rs_tmp.Fields("i_dummy").Value
					lng_fk_organization = rs_tmp.Fields("lng_k_organization").Value'
				end if
				rs_tmp.Close 
				set rs_tmp = Nothing
			end if

		end if

		'Login als division admin
		If lng_fk_organization > 0 Then
			'#1 zuerst muss die head org id ermittelt werden
			queryStr = "SELECT lng_fk_head_organization, i_dummy FROM tbl_0201_organization WHERE lng_k_organization = '" & lng_fk_organization & "'"
			Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
			rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
			If Not rs_tmp.EOF Then
				lng_fk_head_organization = rs_tmp.Fields("lng_fk_head_organization").Value
				i_dummy_sub = rs_tmp.Fields("i_dummy").Value
			end if
			rs_tmp.Close 
			set rs_tmp = Nothing

			If i_dummy_sub > 0 Then
				Session("ses_i_dummy_sub_org")=1
			end if
			
			queryStr = "SELECT i_dummy FROM tbl_0190_head_organization WHERE lng_k_head_organization = '" & lng_fk_head_organization & "'"
			Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
			rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
			If Not rs_tmp.EOF Then
				i_dummy_head = rs_tmp.Fields("i_dummy").Value
			end if
			rs_tmp.Close 
			set rs_tmp = Nothing
			
			If i_dummy_head > 0 Then
				Session("ses_i_dummy_head_org")=1
			end if
		end if
		
		'Login als Trainer
		If lng_fk_trainer > 0 Then
			'#2 zuerst muss die sub org id ermittelt werden
			queryStr = "SELECT lng_fk_organization FROM tbl_0301_trainer WHERE lng_k_trainer = '" & lng_fk_trainer & "'"
			Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
			rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
			If Not rs_tmp.EOF Then
				lng_fk_organization = rs_tmp.Fields("lng_fk_organization").Value
			end if
			rs_tmp.Close 
			set rs_tmp = Nothing

			'#3 zuerst muss die head org id ermittelt werden
			queryStr = "SELECT lng_fk_head_organization, i_dummy FROM tbl_0201_organization WHERE lng_k_organization = '" & lng_fk_organization & "'"
			Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
			rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
			If Not rs_tmp.EOF Then
				lng_fk_head_organization = rs_tmp.Fields("lng_fk_head_organization").Value
				i_dummy_sub = rs_tmp.Fields("i_dummy").Value
			end if
			rs_tmp.Close 
			set rs_tmp = Nothing

			If i_dummy_sub > 0 Then
				Session("ses_i_dummy_sub_org")=1
			end if
			
			queryStr = "SELECT i_dummy FROM tbl_0190_head_organization WHERE lng_k_head_organization = '" & lng_fk_head_organization & "'"
			Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
			rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
			If Not rs_tmp.EOF Then
				i_dummy_head = rs_tmp.Fields("i_dummy").Value
			end if
			rs_tmp.Close 
			set rs_tmp = Nothing
			
			If i_dummy_head > 0 Then
				Session("ses_i_dummy_head_org")=1
			end if
		end if'If lng_fk_trainer > 0 Then

		'Login als athlete
		If lng_fk_athlete > 0 Then
			'#1 zuerst muss die trainer id id ermittelt werden
			queryStr = "SELECT lng_fk_trainer FROM tbl_0401_athlete WHERE lng_k_athlete = '" & lng_fk_athlete & "'"
			Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
			rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
			If Not rs_tmp.EOF Then
				lng_fk_trainer = rs_tmp.Fields("lng_fk_trainer").Value
			end if
			rs_tmp.Close 
			set rs_tmp = Nothing

			'#2 zuerst muss die sub org id ermittelt werden
			queryStr = "SELECT lng_fk_organization FROM tbl_0301_trainer WHERE lng_k_trainer = '" & lng_fk_trainer & "'"
			Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
			rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
			If Not rs_tmp.EOF Then
				lng_fk_organization = rs_tmp.Fields("lng_fk_organization").Value
			end if
			rs_tmp.Close 
			set rs_tmp = Nothing

			'#3 zuerst muss die head org id ermittelt werden
			queryStr = "SELECT lng_fk_head_organization, i_dummy FROM tbl_0201_organization WHERE lng_k_organization = '" & lng_fk_organization & "'"
			Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
			rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
			If Not rs_tmp.EOF Then
				lng_fk_head_organization = rs_tmp.Fields("lng_fk_head_organization").Value
				i_dummy_sub = rs_tmp.Fields("i_dummy").Value
			end if
			rs_tmp.Close 
			set rs_tmp = Nothing

			If i_dummy_sub > 0 Then
				Session("ses_i_dummy_sub_org")=1
			end if
			
			queryStr = "SELECT i_dummy FROM tbl_0190_head_organization WHERE lng_k_head_organization = '" & lng_fk_head_organization & "'"
			Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
			rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
			If Not rs_tmp.EOF Then
				i_dummy_head = rs_tmp.Fields("i_dummy").Value
			end if
			rs_tmp.Close 
			set rs_tmp = Nothing
			
			If i_dummy_head > 0 Then
				Session("ses_i_dummy_head_org")=1
			end if

		end if
'---------------------------------------------------------------------------------------------------------------------------------------------------------------
		Session("ses_i_usergroup") = 0'noch ohne zuweisung
		Session("ses_i_isx") = 0'>> noch keine neue stammdateneingabe übers login
		
		Session("ses_i_head_org")= lng_fk_head_organization
		Session("ses_i_org") = lng_fk_organization
		Session("ses_i_log")=0'0=first login (key)
		Session("ses_str_User_id") = fc_value_string(Session("ses_i_language"), "var_glob_txt_1005")'"New Login"
		Session("ses_str_User_name") = fc_value_string(Session("ses_i_language"), "var_glob_txt_1005")'"New Login"
		Session("ses_str_User_info_all") = fc_value_string(Session("ses_i_language"), "var_glob_txt_1005")'"New Login"
		Session("ses_id_tmp_02") = 0
		Session("ses_i_trainer")= lng_fk_trainer
		Session("ses_i_athlete") = lng_fk_athlete
		
		Session("ses_str_trainer") = ""
		Session("ses_str_head_org") = ""
		Session("ses_str_org") = ""
		
		'2011 12 30 für die textausgabe wer ist angemeldet
		Session("ses_txt_logininfo_z01")=0 'zeile 1
		Session("ses_txt_logininfo_z02")=0 'zeile 2
		Session("ses_txt_logininfo_z03")=0 'zeile 3
		
		If Session("ses_i_dummy_head_org")=1 Then'dummy login
			Session("ses_str_User_name") = fc_value_string(Session("ses_i_language"), "var_glob_txt_1005")'"New Login"
		end if
		
		Session("ses_str_master_id") = str_pw'hqdOur3YoPMg
		Session("ses_str_log_id")= str_user_id'E0-FPCGSYREBB
		
		If Cint(i_type) = 0 Then
			Session("ses_i_type")=0
			Session("ses_frm_first_register") = "registration_02.asp"
			Session("ses_i_first_log")=1'1=first login 0=kein first login
			'vor änderung registration_02.asp dann >>> introduction.asp
			Response.Write ("<SCRIPT LANGUAGE='Javascript'>this.location.href='introduction.asp';</SCRIPT>")
		end if
		
		'2010 01 02
		'i_type 1=Admin / 2=Head Org / 3=Org / 4=Trainer / 5=Athlete
		
		'isx = 0 >> keine neue stammdateneingabe übers login
		'isx = 2 >> neue head org stammdateneingabe übers login
		'isx = 3 >> neue org stammdateneingabe übers login
		'isx = 4 >> neue trainer stammdateneingabe übers login
		'isx = 5 >> neue athlete stammdateneingabe übers login
		
		'usergroup
		''lng_fk_user_group
		'1	SuperVisor	SV 	Admin All
		'2	Head Org	HO 	Head Org Admin
		'3	Org			OR	Org Admin
		'4	Trainer		TR	Trainer Admin
		'5	Athlete		AT	Athlet Admin			

		If Cint(i_type) = 2 Then'Head Org
			Session("ses_i_type")= 2
			Session("ses_i_isx") = 2
			Session("ses_i_usergroup") = 2
			Session("ses_frm_go_back_02") = "index.asp"

			Session("ses_frm_first_register") = "head_org_user_admin_detail.asp?btnSub_02=N"
			Session("ses_i_first_log")=1'1=first login 0=kein first login
			
'2011 12 30 für die textausgabe wer ist angemeldet
Session("ses_txt_logininfo_z01")=fc_value_string(Session("ses_i_language"), "var_glob_txt_1021")'"zb: Angemeldet als:" 'zeile 1
Session("ses_txt_logininfo_z02")=0'"zb: SK Sturm | Growmetry Administrator" 'zeile 2
Session("ses_txt_logininfo_z03")=fc_value_string(Session("ses_i_language"), "var_glob_txt_1023")'"zb: Organisation | Funktion" 'zeile 3
			
			'vor änderung head_org_user_admin_detail.asp?btnSub_02=N dann >>> introduction.asp
			Response.Write ("<SCRIPT LANGUAGE='Javascript'>this.location.href='introduction.asp';</SCRIPT>")
		end if

		If Cint(i_type) = 3 Then'Sub Org
			Session("ses_i_type")= 3
			Session("ses_i_isx") = 3
			Session("ses_i_usergroup") = 3
			Session("ses_frm_go_back_02") = "index.asp"
			
			Session("ses_frm_first_register") = "org_user_admin_detail.asp?btnSub_02=N"
			Session("ses_i_first_log")=1'1=first login 0=kein first login
			'vor änderung org_user_admin_detail.asp?btnSub_02=N dann >>> introduction.asp
			Response.Write ("<SCRIPT LANGUAGE='Javascript'>this.location.href='introduction.asp';</SCRIPT>")
		end if

		If Cint(i_type) = 4 Then'Trainer
			Session("ses_i_type")= 4
			Session("ses_i_isx") = 4
			Session("ses_i_usergroup") = 4
			Session("ses_frm_go_back_02") = "index.asp"
			
			Session("ses_frm_first_register") = "trainer_user_admin_detail.asp?btnSub_02=N"
			Session("ses_i_first_log")=1'1=first login 0=kein first login
			'vor änderung trainer_user_admin_detail.asp?btnSub_02=N dann >>> introduction.asp
			Response.Write ("<SCRIPT LANGUAGE='Javascript'>this.location.href='introduction.asp';</SCRIPT>")
		end if

		If Cint(i_type) = 5 Then'Athlete
			Session("ses_i_type")= 5
			Session("ses_i_isx") = 5
			Session("ses_i_usergroup") = 5
			Session("ses_frm_go_back_02") = "index.asp"
			
			Session("ses_frm_first_register") = "athlete_user_admin_detail.asp?btnSub_02=N"
			Session("ses_i_first_log")=1'1=first login 0=kein first login
			'vor änderung athlete_user_admin_detail.asp?btnSub_02=N dann >>> introduction.asp
			Response.Write ("<SCRIPT LANGUAGE='Javascript'>this.location.href='introduction.asp';</SCRIPT>")
		end if
	end if
	
	'#1b anmeldung mit der master id ist schon abgelaufen
	If Cint(i) = 0 Then
		call showMessage(fc_value_string(Session("ses_i_language"), "var_main_m_32"))'"(10) Diese User Id ist schon abgelaufen. Sie darf nur bei der erstmaligen Anmeldung verwendet werden!"
		Response.Write ("<SCRIPT LANGUAGE='Javascript'>this.location.href='index.asp';</SCRIPT>") 
	end if

'------------------------------------------------------------------------------------------------------------------------------------------
'------------------------------------------------------------------------------------------------------------------------------------------
'------------------------------------------------------------------------------------------------------------------------------------------
'------------------------------------------------------------------------------------------------------------------------------------------
'------------------------------------------------------------------------------------------------------------------------------------------
'------------------------------------------------------------------------------------------------------------------------------------------

else

'normales login----------------------------------------------------------------------------------------------------------------------------
'ueberprueft die eingabe ------------------------------------------------------------------------------------------------------------------
'------------------------------------------------------------------------------------------------------------------------------------------
'------------------------------------------------------------------------------------------------------------------------------------------
'------------------------------------------------------------------------------------------------------------------------------------------
'------------------------------------------------------------------------------------------------------------------------------------------

Set rs = Server.CreateObject("ADODB.RecordSet") 
queryStr = "SELECT str_User_id, str_pw, lng_fk_user_group, lng_fk_country, lng_k_User_ID, str_User_First_Name, str_User_Last_Name FROM tbl_0501_user " & _
"WHERE ((str_User_id='" & str_user_id & "') AND (str_pw='" & str_pw & "') AND (i_fk_status='1'));"
'-------------------------------------------------------------------------------------  
'20090501 - neue sicherheitsstufe - neues login
'Response.Write("ses_iu: " & Session("ses_iu") & "<br>")
'Response.Write("ses_ig: " & Session("ses_ig") & "<br>")

	If Session("ses_iu") = 0 AND Session("ses_ig") = 0 Then
      
        		rs.Open queryStr, objConn, adOpenStatic, adLockReadOnly
				'check if login data could be retrieved from the database
				'if not login was not successfull
				If rs.EOF then
					call showMessage(fc_value_string(Session("ses_i_language"), "var_glob_txt_1006"))'Con_Msg_02 >> "Wrong input!"
					'******************************************************************************
					' alle fehlgeschlagenen login werden archiviert
					' addLogin      
					' add a login entry to the database
					' InputParameter:
					' password ... String
					' userId ... String
					' i_action ...integer...1 >> login...2 >> logout
					' i_session ... die anzahl der versuche bis zu einen gültigen login
					'******************************************************************************
					'Sub addLogin_error (password, userId, i_action, i_session)

					call addLogin_error (str_pw, str_user_id, 1, i_session)
					Response.Write ("<SCRIPT LANGUAGE='Javascript'>this.location.href='index.asp';</SCRIPT>") 
				else
				
					'ermittelt die log-id
					iu = rs.Fields("lng_k_User_ID").Value
					ig = rs.Fields("lng_fk_user_group").Value
					lng_k_User_ID = rs.Fields("lng_k_User_ID").Value

					Session("ses_iu") = iu
					Session("ses_ig") = ig	
	
					Session("ses_str_User_id") = str_User_id
					Session("ses_i_log")=1'0=first login (key) - 1=normales login
	
					str_User_First_Name = ""
					str_User_Last_Name = ""
					Session("ses_str_User_name")= fc_get_username_voll(iu)

					'******************************************************************************
					' gibt den fremdschlüssel (zb. head org, sub org, trainer) des user zurück
					' InputParameter:
					' lng_k_User_ID ... id des user
					' i_info ... 1>> head org - 2>> suborg - 3>> trainer				
					'******************************************************************************
					'Function fc_lng_foreign_key(lng_k_User_ID, i_info)
					'ig >> usergroup
'usergroup
'lng_fk_user_group
'1	SuperVisor	SV 	Admin All
'2	Head Org	HO 	Head Org Admin
'3	Org			OR	Org Admin
'4	Trainer		TR	Trainer Admin
'5	Athlete		AT	Athlet Admin
					If ig = 1 Then
						Session("ses_i_head_org") = 1
						Session("ses_i_org") = 0
					end if
					If ig = 2 Then
						Session("ses_i_head_org") = fc_lng_foreign_key(iu, 1)
						Session("ses_i_org") = fc_lng_foreign_key(iu, 22)'???????????????
					end if
					If ig = 3 Then
						Session("ses_i_org") = fc_lng_foreign_key(iu, 2)
						Session("ses_i_head_org") = fc_lng_foreign_key(Session("ses_i_org"), 11)
					end if
					If ig = 4 Then
						Session("ses_i_trainer") = fc_lng_foreign_key(iu, 3)
						Session("ses_i_org") = fc_lng_foreign_key(Session("ses_i_trainer"), 23)
						Session("ses_i_head_org") = fc_lng_foreign_key(Session("ses_i_org"), 11)
					end if
					If ig = 5 Then
						Session("ses_i_athlete") = fc_lng_foreign_key(iu, 4)
						Session("ses_i_trainer") = fc_lng_foreign_key(Session("ses_i_athlete"), 33)
						Session("ses_i_org") = fc_lng_foreign_key(Session("ses_i_trainer"), 23)
						Session("ses_i_head_org") = fc_lng_foreign_key(Session("ses_i_org"), 11)
						lng_fk_trainer = Session("ses_i_trainer")
						lng_fk_athlete = Session("ses_i_athlete")
					end if
					
					lng_fk_head_organization = Session("ses_i_head_org")
					lng_fk_organization = Session("ses_i_org")

'wichtig >> weil wenn über das admin_overview oder admin_overview_id.asp ein anderes login aufgerufen wird wird dann sonst die eigene session auf 0 gesetzt	
Session("ses_str_userid_tmp")= str_user_id'zeichenfolge muss min 3 zeichen haben
Session("ses_str_pw_tmp")= str_pw
Session("ses_i_head_org_tmp") = Session("ses_i_head_org")					
					
					'lng_fk_user_group
					'1	SuperVisor	SV 	Admin All
					'2	Head Org	HO 	Head Org Admin
					'3	Org			OR	Org Admin
					'4	Trainer		TR	Trainer Admin
					'5	Athlete		AT	Athlet Admin
					Session("ses_i_usergroup") = ig
					Session("ses_i_last_select_01") = 0'default
					'Response.Write("ses_i_usergroup: " & Session("ses_i_usergroup") & "<br>")
					
					str_trenzeichen_info = fc_value_string(Session("ses_i_language"), "var_glob_txt_1009")'das trennzeichen beim infotext rechts oben
					
					If ig = 1 Then'Admin
						Session("ses_str_User_info_all")= fc_value_string(Session("ses_i_language"), "var_glob_txt_1007")'"Administrator - " & Session("ses_str_User_name")'die eingeloggte userid + head org + sub org + trainer
						Session("ses_str_head_org")= fc_value_string(Session("ses_i_language"), "var_glob_txt_1007")'"Growmetry"
						Session("ses_str_org")="-"'string des org
 						Session("ses_str_trainer")="-"'string des trainers
					end if
					
					If ig = 2 Then'Head Org Admin
					str_head_organization = fc_str_head_org(lng_fk_head_organization)
						
'2011 12 30 wird nicht mehr benötigt						
'Session("ses_str_User_info_all")= str_head_organization & " | " & Session("ses_str_User_name")'die eingeloggte userid + head org + sub org + trainer
						
						Session("ses_str_head_org")= str_head_organization
						Session("ses_str_org")="-"'string des org
 						Session("ses_str_trainer")="-"'string des trainers
					end if
					
					If ig = 3 Then'Division oder Typ B
						str_head_organization = fc_str_head_org(lng_fk_head_organization)
						str_sub_organization = fc_get_name_org(lng_fk_organization, 2)

'2012 01 08 wird nicht mehr benötigt
'Session("ses_str_User_info_all")= str_head_organization & str_trenzeichen_info & str_sub_organization & str_trenzeichen_info & Session("ses_str_User_name")'die eingeloggte userid + head org + sub org + trainer

						Session("ses_str_head_org")= str_head_organization
						Session("ses_str_org")= str_sub_organization
 						Session("ses_str_trainer")="-"'string des trainers
						
					end if

					If ig = 4 Then'Trainer oder Typ C
					
						str_head_organization = fc_str_head_org(lng_fk_head_organization)
						str_sub_organization = fc_get_name_org(lng_fk_organization, 2)
							'Response.Write("str_sub_organization: " & str_sub_organization & "<br>")
						str_trainer = fc_get_name_trainer(Session("ses_i_trainer"), 1)
						Session("ses_str_trainer")= str_trainer
					
						'2011 07 16 Typ A
						If lng_fk_head_organization > 1 Then
							str_head_organization = fc_str_head_org(lng_fk_head_organization)
						else
							str_head_organization = "-"
						end if
						
						'2011 07 06 Typ B
						If lng_fk_organization > 1 Then
							str_sub_organization = fc_get_name_org(lng_fk_organization, 2)
						else
							'gibt den namen des Trainers (Tabelle <tbl_0301_trainer> feld <str_trainer>) zurück
							'ist bei typ C der Orgname
							'******************************************************************************
							' gibt den namen des trainers zurück
							' InputParameter:
							' iu ... die id des datensatzes
							' i_info ... abfrageinfo
							'******************************************************************************
							'Function fc_get_name_trainer(id, i_info)
							str_sub_organization = fc_get_name_trainer(Session("ses_i_trainer"), 3)
						end if
						
'2012 01 08 wird nicht mehr benötigt						
'Session("ses_str_User_info_all")= str_head_organization & str_trenzeichen_info & str_sub_organization & str_trenzeichen_info & Session("ses_str_User_name")'die eingeloggte userid + head org + sub org + trainer

'						'wenn es ein echter Typ C ist
'						If lng_fk_head_organization = 1 and lng_fk_organization = 1 Then
'							str_head_organization = "-"
'							str_sub_organization = "-"
'						end if
						
						Session("ses_str_head_org")= str_head_organization
						Session("ses_str_org")= str_sub_organization
 						Session("ses_str_trainer")= str_trainer
						
'						Response.Write("str_head_organization: " & str_head_organization & "<br>")
'						Response.Write("str_sub_organization: " & str_sub_organization & "<br>")
'						Response.Write("str_trainer: " & str_trainer & "<br>")
'						Response.Write("lng_fk_head_organization: " & lng_fk_head_organization & "<br>")
'						Response.Write("lng_fk_organization: " & lng_fk_organization & "<br>")

					end if

					If ig = 5 Then'Athlete
					
						str_head_organization = fc_str_head_org(lng_fk_head_organization)
						str_sub_organization = fc_get_name_org(lng_fk_organization, 2)
						str_trainer = fc_get_name_trainer(lng_fk_trainer, 1)

						Session("ses_str_head_org")= str_head_organization
						Session("ses_str_org")= str_sub_organization
 						Session("ses_str_trainer")= str_trainer
					
					
'2012 01 08 wird nicht mehr benötigt					
'Session("ses_str_User_info_all")= str_head_organization & str_trenzeichen_info & str_sub_organization & str_trenzeichen_info & fc_value_string(Session("ses_i_language"), "var_glob_txt_1010") & str_trainer & str_trenzeichen_info & Session("ses_str_User_name")'die eingeloggte userid + head org + sub org + trainer + Athlete
					end if
					
'überprüft jetzt ob die login in ordnung sind
'ob userid und pw ok sind - 0 > OK  - 1 >> gesperrt
					'******************************************************************************
					' überprüft ob die zugangsdaten (userid und pw) eindeutig sind
					' InputParameter:
					' i_check ... 0 >> es wird nur überprüft ob die user id eindeutig ist / 1 >> user id und pw müssen zusammen eindeutig sein
					' str_User_id ... die eingegebene user id
					' str_pw ... das eingegebene passwort
					' lng_k_User_ID ... der aktuelle user
					' i_info ... ob es eine neuanlage ist (0) oder schon ein bestehender user ist (1)
					'******************************************************************************
					'ob userid und pw ok sind - A1 >> nein - A0 >> ok
					'Function fc_str_check_logindata(i_check, str_User_id, str_pw, lng_k_User_ID, i_info)
					str_logfree  = fc_str_check_logindata(1, str_User_id, str_pw, lng_k_User_ID, 1)
					
					If str_logfree = "A1" Then
						call showMessage(fc_value_string(Session("ses_i_language"), "var_glob_txt_1006"))'Your login details are not correct! Please change your USER ID or PASSWORD!
						Session("str_logfree") = "A1"
					else
						Session("str_logfree") = "A0"
					end if

					call addLogin (str_pw, str_user_id, 1, i_session, lng_k_User_ID)
					
					'lng_fk_user_group
					'1	SuperVisor	SV 	Admin All
					'2	Head Org	HO 	Head Org Admin
					'3	Org			OR	Org Admin
					'4	Trainer		TR	Trainer Admin
					'5	Athlete		AT	Athlet Admin
					
					'isx = 0 >> keine neue stammdateneingabe übers login
					'isx = 2 >> neue head org stammdateneingabe übers login
					'isx = 3 >> neue org stammdateneingabe übers login
					'isx = 4 >> neue coach stammdateneingabe übers login
					'isx = 5 >> neue child stammdateneingabe übers login
					Session("ses_i_isx") = 0
					
					'Überprüft ob dieses login auch aktiviert ist
					i_link_activate = 2
					queryStr = "SELECT i_link_activate FROM tbl_0101_master_id WHERE lng_fk_User_ID = '" & iu & "' "
					Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
					rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly   
				
					If Not rs_tmp.EOF Then
						i_link_activate = rs_tmp.Fields("i_link_activate").Value 
					end if
					
					rs_tmp.close 
					set rs_tmp = Nothing 
					
					'login falsch >> zurück zum loginfenster
'					call showMessage(i_link_activate)
'					Response.Write("queryStr: " & queryStr & "<br>")
'					Response.Write("i_link_activate: " & i_link_activate & "<br>")
					
					If i_link_activate = 0 Then'0 >> link noch nicht aktiviert 1>> link aktiviert
						'71 - wenn mit nicht zusammen passenden logindaten ein emaillink aktiviert werden soll	
						'call showMessage(Con_Msg_72)
						
						'NEU 2010 05 01 aktiviert den USER (auch ohne emaillink)
						queryStr = "UPDATE tbl_0101_master_id SET " & _
						"i_link_activate = '" & 1 & "'" & _
						" WHERE lng_fk_User_ID ='" & iu & "'"
						objConn.Execute queryStr
					end if

'---------------------------------------------------------------------------------------------------------------------------------------------------------------
'überprüfung ob diese head-org eine dummy head org ist
'wenn es für den angelegten user eine dummy head org (Non Commercial) darüber gibt >>> = 1	
		Session("ses_i_dummy_head_org")=0
		Session("ses_i_dummy_sub_org")=0

		'Login als head org admin oder als ein user der sich beim auswählen für eine sub org entscheidet
		If lng_fk_head_organization > 0 Then
			queryStr = "SELECT i_dummy FROM tbl_0190_head_organization WHERE lng_k_head_organization = '" & lng_fk_head_organization & "'"
			Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
			rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
			If Not rs_tmp.EOF Then
				i_dummy_head = rs_tmp.Fields("i_dummy").Value
			end if
			rs_tmp.Close 
			set rs_tmp = Nothing
			
			If i_dummy_head > 0 Then
				Session("ses_i_dummy_head_org")=1
			end if
			
			'call showMessage("Dummy Check")
		end if

		'Login als org admin
		If lng_fk_organization > 0 Then
			'#1 zuers_tmpt muss die head org id ermittelt werden
			queryStr = "SELECT lng_fk_head_organization, i_dummy FROM tbl_0201_organization WHERE lng_k_organization = '" & lng_fk_organization & "'"
			Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
			rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
			If Not rs_tmp.EOF Then
				lng_fk_head_organization = rs_tmp.Fields("lng_fk_head_organization").Value
				i_dummy_sub = rs_tmp.Fields("i_dummy").Value
			end if
			rs_tmp.Close 
			set rs_tmp = Nothing

			If i_dummy_sub > 0 Then
				Session("ses_i_dummy_sub_org")=1
			end if
			
			queryStr = "SELECT i_dummy FROM tbl_0190_head_organization WHERE lng_k_head_organization = '" & lng_fk_head_organization & "'"
			Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
			rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
			If Not rs_tmp.EOF Then
				i_dummy_head = rs_tmp.Fields("i_dummy").Value
			end if
			rs_tmp.Close 
			set rs_tmp = Nothing
			
			If i_dummy_head > 0 Then
				Session("ses_i_dummy_head_org")=1
			end if
			
			'call showMessage("Dummy Check")
		end if
		
		'Login als Trainer
		If lng_fk_trainer > 0 Then
			'#2 zuerst muss die sub org id ermittelt werden
			queryStr = "SELECT lng_fk_organization FROM tbl_0301_trainer WHERE lng_k_trainer = '" & lng_fk_trainer & "'"
			Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
			rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
			If Not rs_tmp.EOF Then
				lng_fk_organization = rs_tmp.Fields("lng_fk_organization").Value
			end if
			rs_tmp.Close 
			set rs_tmp = Nothing

			'#3 zuerst muss die head org id ermittelt werden
			queryStr = "SELECT lng_fk_head_organization, i_dummy FROM tbl_0201_organization WHERE lng_k_organization = '" & lng_fk_organization & "'"
			Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
			rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
			If Not rs_tmp.EOF Then
				lng_fk_head_organization = rs_tmp.Fields("lng_fk_head_organization").Value
				i_dummy_sub = rs_tmp.Fields("i_dummy").Value
			end if
			rs_tmp.Close 
			set rs_tmp = Nothing

			If i_dummy_sub > 0 Then
				Session("ses_i_dummy_sub_org")=1
			end if
			
			queryStr = "SELECT i_dummy FROM tbl_0190_head_organization WHERE lng_k_head_organization = '" & lng_fk_head_organization & "'"
			Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
			rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
			If Not rs_tmp.EOF Then
				i_dummy_head = rs_tmp.Fields("i_dummy").Value
			end if
			rs_tmp.Close 
			set rs_tmp = Nothing
			
			If i_dummy_head > 0 Then
				Session("ses_i_dummy_head_org")=1
			end if
		
		end if

		'Login als athlete
		If lng_fk_athlete > 0 Then
			'#1 zuerst muss die trainer id id ermittelt werden
			queryStr = "SELECT lng_fk_trainer FROM tbl_0401_athlete WHERE lng_k_athlete = '" & lng_fk_athlete & "'"
'			Response.Write(queryStr & "<br>")
'			Response.End()
			Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
			rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
			If Not rs_tmp.EOF Then
				lng_fk_trainer = rs_tmp.Fields("lng_fk_trainer").Value
			end if
			rs_tmp.Close 
			set rs_tmp = Nothing

			'#2 zuerst muss die sub org id ermittelt werden
			queryStr = "SELECT lng_fk_organization FROM tbl_0301_trainer WHERE lng_k_trainer = '" & lng_fk_trainer & "'"
'			Response.Write(queryStr & "<br>")
'			Response.End()
			Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
			rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
			If Not rs_tmp.EOF Then
				lng_fk_organization = rs_tmp.Fields("lng_fk_organization").Value
			end if
			rs_tmp.Close 
			set rs_tmp = Nothing

			'#3 zuerst muss die head org id ermittelt werden
			queryStr = "SELECT lng_fk_head_organization, i_dummy FROM tbl_0201_organization WHERE lng_k_organization = '" & lng_fk_organization & "'"
'			Response.Write(queryStr & "<br>")
'			response.End()
			
			Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
			rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
			If Not rs_tmp.EOF Then
				lng_fk_head_organization = rs_tmp.Fields("lng_fk_head_organization").Value
				i_dummy_sub = rs_tmp.Fields("i_dummy").Value
			end if
			rs_tmp.Close 
			set rs_tmp = Nothing

			If i_dummy_sub > 0 Then
				Session("ses_i_dummy_sub_org")=1
			end if
			
			queryStr = "SELECT i_dummy FROM tbl_0190_head_organization WHERE lng_k_head_organization = '" & lng_fk_head_organization & "'"
'			Response.Write(queryStr)
'			response.End()

			Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
			rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
			If Not rs_tmp.EOF Then
				i_dummy_head = rs_tmp.Fields("i_dummy").Value
			end if
			rs_tmp.Close 
			set rs_tmp = Nothing
			
			If i_dummy_head > 0 Then
				Session("ses_i_dummy_head_org")=1
			end if
			
			'das voreingestellte messsytem wird ermittelt
			i_fk_measured_system = 1'metric default
			queryStr = "SELECT i_fk_measured_system FROM tbl_0801_athlete_measured WHERE lng_fk_User_ID = '" & lng_fk_athlete & "' AND i_fk_measured_type ='" & 1 & "'"
			'Response.Write(queryStr)
			Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
			rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
			If Not rs_tmp.EOF Then
				i_fk_measured_system = rs_tmp.Fields("i_fk_measured_system").Value
			end if
			rs_tmp.Close 
			set rs_tmp = Nothing

			Session("ses_i_measured_system") = i_fk_measured_system
			
		end if		
		'call showMessage("Dummy Check: " & Session("ses_i_dummy_head_org"))	
'---------------------------------------------------------------------------------------------------------------------------------------------------------------					

        	end if'If rs.EOF then
		rs.Close 
		set rs = Nothing 
		
'20101210 die sessions werden auf NULL gesetzt - wenn darüber keine ORGS gibt
'1 >>> bedeutet Dummy
If Session("ses_i_dummy_head_org") = 1 and Session("ses_i_dummy_sub_org") = 0 Then
	Session("ses_str_head_org") = "-"
	'Session("ses_str_org") = "-"
end if
If Session("ses_i_dummy_head_org") = 1 and Session("ses_i_dummy_sub_org") = 1 Then
	Session("ses_str_head_org") = "-"
	Session("ses_str_org") = "-"
end if

'2011 07 16 Ausnahme beim Typ C
If Session("ses_i_dummy_head_org") = 1 and Session("ses_i_dummy_sub_org") = 1 and ig = 4 Then'Trainer
	Session("ses_str_head_org") = "-"
	Session("ses_str_org") = fc_get_name_trainer(Session("ses_i_trainer"), 3)
end if
	
	else

'noch offen????
Session("ses_iu") = 1'Admin
Session("ses_ig") = 1'SuperVisor
Session("ses_str_User_id") = "admin"
Session("ses_i_modul_01") = 3

	end if'If Session("ses_iu") = 0 AND Session("ses_ig") = 0 Then
end if''falls man noch nicht eingeloggt ist ('If iu = 0 and ig = 0 Then)

'-------------------------------------------------------------------
'bestimmt welches recht der user im Main hat
'Dim lng_fk_user_group 
'Dim lng_fk_User_ID_admin
'Dim lng_fk_organization
'Dim lng_fk_trainer

'lng_fk_user_group
'1	SuperVisor	SV 	Admin All
'2	Head Org	HO 	Head Org Admin
'3	Org			OR	Org Admin
'4	Trainer		TR	Trainer Admin
'5	Athlete		AT	Athlet Admin
'---------------------------------------------------------------------------------------------------
'gibt alle relationalen id zurück
'isx = 0 >> keine neue stammdateneingabe übers login
'isx > 1 >> stammdateneingabe übers login (master loggin)
isx = 0
'----------------------------------------------------------------------
end if'If str_user_id_short = Session("ses_first_log") Then      

'20110119
'enscheidet welche reports der user sehen darf 
id_head_org = Session("ses_i_head_org")
'Response.Write("ID Head ORG: " & Session("ses_i_head_org") & "<br>")
i_usergroup = Session("ses_i_usergroup") 
		
'lng_fk_user_group
'1	SuperVisor	SV 	Admin All
'2	Head Org	HO 	Head Org Admin
'3	Org			OR	Org Admin
'4	Trainer		TR	Trainer Admin
'5	Athlete		AT	Athlet Admin

	i_report_01 = 0'default >> kein recht >> admin_overview_status.asp
	i_report_02 = 0'default >> kein recht >> admin_overview_id.asp
	
	If i_usergroup = 1 Then'administrator
		i_report_01 = 1' >> admin_overview_status.asp
		i_report_02 = 1' >> admin_overview_id.asp
	end if

str_text_trennzeichen = fc_value_string(Session("ses_i_language"), "var_glob_txt_1009")'"New Login"
	
	If i_usergroup = 2 Then
	
'2011 12 30 für die textausgabe wer ist angemeldet
'2012 02 25 menü rechts oben hier eingelesen werde
Session("ses_txt_logininfo_z01")=fc_value_string(Session("ses_i_language"), "var_glob_txt_1021")'"zb: Angemeldet als:" 'zeile 1
Session("ses_txt_logininfo_z02")=Session("ses_str_head_org") & " " & str_text_trennzeichen & " " & fc_value_string(Session("ses_i_language"), "var_glob_txt_1024")'"zb: SK Sturm | Growmetry Administrator" 'zeile 2
Session("ses_txt_logininfo_z03")=fc_value_string(Session("ses_i_language"), "var_glob_txt_1023")'"zb: Organisation | Funktion" 'zeile 3
	
		'admin_overview_dynamic.asp
		queryStr = "SELECT i_head_org FROM tbl_0504_user_reporting WHERE lng_fk_head_organization = '" & id_head_org & "' AND i_report ='" & 1 & "'"
		'Response.Write(queryStr)
		Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
		rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
		If Not rs_tmp.EOF Then
			i_report_01 = rs_tmp.Fields("i_head_org").Value
		end if
		rs_tmp.Close
	
		'admin_overview_id.asp (mit Login)
		queryStr = "SELECT i_head_org FROM tbl_0504_user_reporting WHERE lng_fk_head_organization = '" & id_head_org & "' AND i_report ='" & 2 & "'"
		'Response.Write(queryStr)
		Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
		rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
		If Not rs_tmp.EOF Then
			i_report_02 = rs_tmp.Fields("i_head_org").Value
		end if
		rs_tmp.Close
	end if 
	
	'Division
	If i_usergroup = 3 Then
	
'		Response.Write("ses_i_dummy_head_org:" & Session("ses_i_dummy_head_org") & "<br>")
'		Response.Write("ses_i_dummy_sub_org:" & Session("ses_i_dummy_sub_org") & "<br>")

		'2011 12 30 für die textausgabe wer ist angemeldet
		'2012 02 25 menü rechts oben hier eingelesen werde
		Session("ses_txt_logininfo_z01")=fc_value_string(Session("ses_i_language"), "var_glob_txt_1021")'"zb: Angemeldet als:" 'zeile 1

		If Session("ses_i_dummy_head_org") = 0 and Session("ses_i_dummy_sub_org") = 0 Then'Typ A >> Division
		Session("ses_txt_logininfo_z02")=Session("ses_str_head_org") & " " & str_text_trennzeichen & " " & Session("ses_str_org") & " " & str_text_trennzeichen & " " & fc_value_string(Session("ses_i_language"), "var_glob_txt_1024")'"zb: SK Sturm | Growmetry Administrator" 'zeile 2
		Session("ses_txt_logininfo_z03")=fc_value_string(Session("ses_i_language"), "var_glob_txt_1026")'"zb: Organisation | Funktion" 'zeile 3
		end if

		If Session("ses_i_dummy_head_org") = 1 and Session("ses_i_dummy_sub_org") = 0 Then'Typ B >> ORG
		Session("ses_txt_logininfo_z02")= Session("ses_str_org") & " " & str_text_trennzeichen & " " & fc_value_string(Session("ses_i_language"), "var_glob_txt_1024")'"zb: SK Sturm | Growmetry Administrator" 'zeile 2
		Session("ses_txt_logininfo_z03")=fc_value_string(Session("ses_i_language"), "var_glob_txt_1023")'"zb: Organisation | Funktion" 'zeile 3
		end if
		
		'admin_overview_dynamic.asp
		queryStr = "SELECT i_head_org FROM tbl_0504_user_reporting WHERE lng_fk_head_organization = '" & id_head_org & "' AND i_report ='" & 1 & "'"
		'Response.Write(queryStr)
		Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
		rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
		If Not rs_tmp.EOF Then
			i_report_01 = rs_tmp.Fields("i_head_org").Value
		end if
		rs_tmp.Close
		
		i_report_02 = 0'kein öffen
		'admin_overview_id.asp (mit Login)
	end if 
	
	'Trainer
	If i_usergroup = 4 Then

	'2011 12 30 für die textausgabe wer ist angemeldet
	'2012 02 25 menü rechts oben hier eingelesen werde
	Session("ses_txt_logininfo_z01")=fc_value_string(Session("ses_i_language"), "var_glob_txt_1021")'"zb: Angemeldet als:" 'zeile 1
	
	'Nur bei typ C oder Typ B Trainer
	If Session("ses_i_dummy_head_org") = 1 and Session("ses_i_dummy_sub_org") = 1 or Session("ses_i_dummy_head_org") = 1 and Session("ses_i_dummy_sub_org") = 0 Then
	'"zb: SK Sturm | Growmetry Administrator" 'zeile 2
	Session("ses_txt_logininfo_z02")= Session("ses_str_org") & " " & str_text_trennzeichen & " " & fc_value_string(Session("ses_i_language"), "var_glob_txt_1025")
	'"zb: Organisation | Funktion" 'zeile 3
	Session("ses_txt_logininfo_z03")=fc_value_string(Session("ses_i_language"), "var_glob_txt_1023")
	else
	'"zb: SK Sturm | Growmetry Administrator" 'zeile 2
	Session("ses_txt_logininfo_z02")=Session("ses_str_head_org") & " " & str_text_trennzeichen & " " & Session("ses_str_org") & " " & str_text_trennzeichen & " " & fc_value_string(Session("ses_i_language"), "var_glob_txt_1025")
	'"zb: Organisation | Funktion" 'zeile 3
	Session("ses_txt_logininfo_z03")=fc_value_string(Session("ses_i_language"), "var_glob_txt_1026")
	end if

		'admin_overview_dynamic.asp
		queryStr = "SELECT i_head_org FROM tbl_0504_user_reporting WHERE lng_fk_head_organization = '" & id_head_org & "' AND i_report ='" & 1 & "'"
		'Response.Write(queryStr)
		Set rs_tmp = Server.CreateObject("ADODB.RecordSet")
		rs_tmp.Open queryStr, objConn, adOpenStatic, adLockReadOnly  
		If Not rs_tmp.EOF Then
			i_report_01 = rs_tmp.Fields("i_head_org").Value
		end if
		rs_tmp.Close
		
		i_report_02 = 0'kein öffnen
		'admin_overview_id.asp (mit Login)
	end if 


	'Athlete
	If i_usergroup = 5 Then

'2011 12 30 für die textausgabe wer ist angemeldet
'2012 02 25 menü rechts oben hier eingelesen werde
Session("ses_txt_logininfo_z01")=fc_value_string(Session("ses_i_language"), "var_glob_txt_1020")'"zb: Angemeldet als:" 'zeile 1
Session("ses_txt_logininfo_z02")=Session("ses_str_head_org") & " " & str_text_trennzeichen & " " & Session("ses_str_org") & " " & str_text_trennzeichen & " " & Session("ses_str_trainer")'"zb: SK Sturm | Growmetry Administrator" 'zeile 2
Session("ses_txt_logininfo_z03")=fc_value_string(Session("ses_i_language"), "var_glob_txt_1022")'"zb: Organisation | Funktion" 'zeile 3
	
	end if 						

'i_report_01 >> admin_overview_status.asp
'i_report_02 >> admin_overview_id.asp

'wichtig >> weil wenn über das admin_overview oder admin_overview_id.asp ein anderes login aufgerufen wird wird dann sonst die eigene session auf 0 gesetzt	
'denn wenn man kein recht auf die admin_overview oder admin_overview_id.asp hat dann werden diese beiden sessions auf 0 gesetzt
'If i_usergroup > 1 or i_report_02 <> 1 Then'nur reports wo es ein loggin für andere user möglich ist
If i_report_02 <> 1 Then'nur reports wo es ein loggin für andere user möglich ist
	Session("ses_str_userid_tmp")= 0
	Session("ses_str_pw_tmp")= 0
	Session("ses_i_head_org_tmp") = 0
end if	

'Response.Write("i_usergroup: " & i_usergroup & "<br>")
'Response.Write("i_report_02: " & i_report_02 & "<br>")	
'Response.Write("ses_str_userid_tmp: " & Session("ses_str_userid_tmp") & "<br>")
'Response.Write("ses_str_pw_tmp: " & Session("ses_str_pw_tmp") & "<br>")				
'Response.Write("i_head_org_tmp: " & Session("ses_i_head_org_tmp") & "<br>")

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/vorlage_std_all.dwt" codeOutsideHTMLIsLocked="false" -->
<!-- ----------------------------------------------------------- -->
<!--       Beratung, Projektierung, Webdesign und Umsetzung      -->
<!--                     www.on-designs.com                      -->
<!-- Christian Freidl, Gärtnerweg 6, 8073 Neuseiersberg, Austria -->
<!-- ----------------------------------------------------------- -->
<!-- ----------------------------------------------------------- -->
<!--        Beratung, Projektierung, ASP-Programmierung          -->
<!--                     www.bribase.com                         -->
<!--                    Peter Brislinger,                        -->
<!--        Paul-Anton-Keller-Gasse 23, 8073 Feldkirchen         -->
<!-- ----------------------------------------------------------- -->
<head>
<% CALL writeGwmCustomHeaders %>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title><%= str_title %>- Home</title>
<!-- InstanceEndEditable -->
<LINK REL="SHORTCUT ICON" HREF="http://www.growmetry.com/favicon.ico">
<meta name="author" content="Programming by Peter Brislinger, http://www.bribase.com | Web & Interfacedesign by Christian Freidl, http://www.on-designs.com">
<meta name="robots" content="noindex, nofollow">
<meta name="audience" content="all">
<style type="text/css">
<!--
A:link, A:visited, A:active {text-decoration: none; color:#333333}
A:hover {text-decoration: underline}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	scrollbar-face-color: #ffffff; 
	scrollbar-highlight-color: #ffffff;
	scrollbar-shadow-color: #cccccc;
	scrollbar-3dlight-color: #cccccc;
	scrollbar-arrow-color: #666666;
	scrollbar-track-color: #ffffff;
	scrollbar-darkshadow-color: #ffffff;
}
-->
</style>
<link href="../css/growmetry.css" rel="stylesheet" type="text/css" />
<!-- start change password includes -->
<link type='text/css' href='css/popup.css' rel='stylesheet' />
<link type='text/css' href='css/ch_pw.css' rel='stylesheet' />
<script type="text/javascript" src="js/jquery.js"></script>
<script type='text/javascript' src='js/jquery.simplemodal-1.4.4.js'></script>
<script type='text/javascript' src='js/popup.js'></script>
<script type='text/javascript' src='js/ch_pw.js'></script>
<script>
    lng_k_email_inquiry = '90';
    str_User_id = 'hbc123';
//    lng_k_email_inquiry = '';
//    str_User_id = '';

window.onload = win_onload;
</script>
<!-- end change password includes -->


<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
<!--
.Stil1 {
	font-size: 12px;
	font-weight: bold;
}
.Stil7 {color: #818181}
.Stil8 {font-size: 10px}
.Stil9 {color: #000000}
-->
</style>
<%
	'include scripts for the menu
	CALL userMenuAddScripts
%>
<!-- InstanceEndEditable -->
</head>

<body>
<script type="text/javascript" src="includes/wz_tooltip.js"></script>
<script type="text/javascript" language="JavaScript">
function change_language(i)
{
//http://www.growmetry.com/APX_Translate/main_menu.asp
//var str_domain = "www.growmetry.com"
//var str_pathname = window.location.pathname;
//var str_ziel = str_domain && str_pathname;


var str_ziel = new String(window.location);

var p1 = get_page_params();
var p2 = get_page_params();

var i_language ="0";//default - 0=bedeutet ohne lng=x // 1=mit lng=x zb. .asp?lng=1
var i_asp="0";//default -1=bedeutet das in der url zum schluss nur mehr asp steht // 0=das in der url schon zusätzliche parameter stehen zb: .asp?btnsub=N oder .asp?lng=1

//überprüft ob schon ein sprachinfo in der url ist
	  if (p2['lng']) 
	  {
	  	//Do something
	  	i_language = 1
		//alert("NNNN");
	  }  
	  else
	  {
	  	i_language = 0   
	  }


//Überprüft ob es eine info in der URL gibt
	  var str_asp_default = "asp";
	  //var i_laenge = str_ziel.length;
	  //var str_last03 = new String((str_ziel[i_laenge-3] + str_ziel[i_laenge-2] + str_ziel[i_laenge-1]));
	  var str_last03 = str_ziel.substr((str_ziel.length)-3); //liefert die letzten drei zeichen
	  
	  if (str_last03 == str_asp_default)//german
	  {
		//default 1=bedeutet das in der url zum schluss nur mehr asp steht
		i_asp = 1;
	  }
	  else
	  {
		//default 0=das in der url schon zusätzliche parameter stehen zb: .asp?btnsub=N oder .asp?lng=1
		i_asp = 0;
	  }
	  

//alert("str_ziel: " + str_ziel);
//alert("str_last03: " + str_last03);
//alert("i: " + i);
//alert("i_language: " + i_language);	  
//alert("i_asp: " + i_asp);

//wenn in der url noch keine parameter sind und die sprachinfo auch fehlt
	  if (i_asp == "1" && i=="1" && i_language=="0")//german
	  {
			str_ziel = str_ziel + "?lng=1"  
	  }
	  if (i_asp == "1" && i=="2" && i_language=="0")//english
	  {
			str_ziel = str_ziel + "?lng=2"  
	  }

//wenn in der url schon parameter sind und die sprachinfo auch fehlt
	  if (i_asp == "0" && i=="1" && i_language=="0")//german
	  {
			str_ziel = str_ziel + "&lng=1"  
	  }
	  if (i_asp == "0" && i=="2" && i_language=="0")//english
	  {
			str_ziel = str_ziel + "&lng=2"  
	  }

//wird nur ausgeführt wenn schon eine sprachinfo in der url ist
	  if (i == "1")//german
	  {
		  str_ziel = SuchenUndErsetzen(str_ziel, "lng=2", "lng=1")
	  } 
	  
	  if (i == "2")//English
	  {
		  str_ziel = SuchenUndErsetzen(str_ziel, "lng=1", "lng=2")
	  } 


	window.location.href = str_ziel;
}

function SuchenUndErsetzen(QuellText, SuchText, ErsatzText)
	  {   // Erstellt von Ralf Pfeifer
		  // Fehlerpruefung
		  if ((QuellText == null) || (SuchText == null))           { return null; }
		  if ((QuellText.length == 0) || (SuchText.length == 0))   { return QuellText; }

		  // Kein ErsatzText ?
		  if ((ErsatzText == null) || (ErsatzText.length == 0))    { ErsatzText = ""; }

		  var LaengeSuchText = SuchText.length;
		  var LaengeErsatzText = ErsatzText.length;
		  var Pos = QuellText.indexOf(SuchText, 0);

		  while (Pos >= 0)
		  {
			  QuellText = QuellText.substring(0, Pos) + ErsatzText + QuellText.substring(Pos + LaengeSuchText);
			  Pos = QuellText.indexOf(SuchText, Pos + LaengeErsatzText);
		  }
		  return QuellText;
	  } 


//sucht einen String innerhalb eines Strings (Andrey)
function get_page_params() 
{
       function unspace( qs_element ) {
               return qs_element.split( '+' ).join( ' ' );
       }
       var QueryString = new Array();
       QueryString["_"]="";
       if ( location.search.length > 1 ) {
               var qs_query = location.search.substring( 1, location.search.length );
               var qs_pairs = qs_query.split( '&' );
               for ( var qs_index = 0; qs_index < qs_pairs.length; qs_index++ ) {
                       var qs_element = qs_pairs[qs_index].split( '=' );
                       QueryString[qs_element[0]] = unspace( unescape( qs_element[1] ) );
               }
       }
       return QueryString;

}


</SCRIPT>  

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" class="backout">
<table width="950" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="479" valign="top" background="../App/images/standard/filler_vert.gif"><table width="950" border="0" cellpadding="0" cellspacing="0" class="<%= fc_value_string(Session("ses_i_language"), "var_glob_bitm_20") %>">
<tr>
<td width="25" height="90">&nbsp;</td>
<td width="900" height="90">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="bottom"><div align="right" class="txtsm">
</div>
<div align="right">
<div align="right" class="txtsm"></div>
</div>

<div align="right"><span class="txtloginasgrey"><%=Session("ses_txt_logininfo_z01")%></span><span class="txtloginasred"><strong><%=Session("ses_str_User_name")%></strong></span>
<span class="txtloginasgrey"> <%= fc_value_string(Session("ses_i_language"), "var_glob_txt_1009") %> <a href="index.asp"><%= fc_value_string(Session("ses_i_language"), "var_glob_txt_02") %></a></span><br/>
<strong class="txtloginasgreen"><%=Session("ses_txt_logininfo_z02")%> </strong><br/>
<span class="txtloginasgrey"><%=Session("ses_txt_logininfo_z03")%></span><br/>
</div>
</td>
</tr>
</table>
</td>
<td width="25" height="90">&nbsp;</td>
</tr>
<tr>
<td width="25">&nbsp;</td><!-- InstanceBeginEditable name="Edit_navi" -->
<td width="900" align="left" class="navi">
	<table border="0" cellpadding="0" cellspacing="0" width="900">
		<td>
			<%
				'include menu object
				CALL userMenuWriteMenuObj("userMenu")
				CALL userMenuWriteInitScript("userMenu", objConn, getGroupByUser(objConn, Session("ses_iu")), Session("ses_i_language"))
			%>    		
		</td>
		<td align="right">
			<div style="padding-right: 5px; ">
			<% CALL userMenuInsertPagePath(objConn, getGroupByUser(objConn, Session("ses_iu")), Session("ses_i_language"), "main_menu.asp") %>
		    </div>
		</td>
	</table>  
</td>
        <!-- InstanceEndEditable -->
<td width="25">&nbsp;</td>
</tr>
<tr>
<td width="25">&nbsp;</td><!-- InstanceBeginEditable name="Edit_Content" -->
<td width="900" height="450" align="left" valign="top" class="<%= fc_value_string(Session("ses_i_language"), "var_glob_bitm_22") %>"><table width="900" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="278" height="90">
</td>
<td width="149" height="90">&nbsp;</td>
<td width="149" height="90" align="center" valign="middle">&nbsp;</td>
<td width="149" height="90">&nbsp;</td>
<td width="149" height="90">&nbsp;</td>
<td width="26" height="90">&nbsp;</td>
</tr>
<tr>
<td width="278" height="100%" valign="top">
<div align="right">

<%
'usergroup
'Session("ses_i_usergroup")
'1	SuperVisor	SV 	Admin All
'2	Head Org	HO 	Head Org Admin
'3	Org			OR	Org Admin oder Abteilungsadmin
'4	Trainer		TR	Trainer Admin
'5	Athlete		AT	Athlet Admin
lng_fk_user_group_ses = Session("ses_i_usergroup")
'Response.Write("lng_fk_user_group_ses: " & lng_fk_user_group_ses & "<br>")

'1 >> Dummy
'0 >> no dummy
Dim i_dummy_head_org
i_dummy_head_org=Session("ses_i_dummy_head_org")
'Response.Write("i_dummy_head_org: " & i_dummy_head_org & "<br>")


'userprofil
Dim str_target_userprofil'zielseite	
Dim str_titel_userprofil
Dim str_caption_userprofil

'einladung
Dim str_target_invitation
Dim str_titel_invitation
Dim str_caption_invitation

'übersicht einladungen
Dim str_target_invitation_ov
Dim str_titel_invitation_ov
Dim str_caption_invitation_ov

'übersicht
Dim str_target_overview	
Dim str_titel_overview
Dim str_caption_overview

'statusreport	
Dim str_target_status_rpt
Dim str_titel_status_rpt
Dim str_caption_status_rpt

'adminreport	
Dim str_target_admin_rpt
Dim str_titel_admin_rpt
Dim str_caption_admin_rpt

'messdaten	
Dim str_target_measured
Dim str_titel_measured
Dim str_caption_measured

'berechnung (grafik)	
Dim str_target_graphic
Dim str_titel_graphic
Dim str_caption_graphic


Dim i_height'zeilenhöhe
i_height = 5

'Response.Write("Session(ses_i_usergroup): " & Session("ses_i_usergroup") & "<br>")
'Response.Write("i_dummy_head_org: " & i_dummy_head_org & "<br>")
'Response.Write("iu: " & iu & "<br>")
''Response.Write("str_ziel: " & str_ziel & "<br>")
'Response.Write("i_report_01: " & i_report_01 & "<br>")
'Typ A ------------------------------------------------------------------------------
'Admin einer Head Org	
If Cint(lng_fk_user_group_ses) = 2 and Cint(iu) > 0 Then 

	str_target_userprofil = "head_org_user_admin_detail.asp"
	str_titel_userprofil = fc_value_string(Session("ses_i_language"), "var_main_m_23")'"Benutzer-Profil bearbeiten" >>> Hints
	str_caption_userprofil = fc_value_string(Session("ses_i_language"), "var_main_m_13")'"Benutzer-Profil" >>> sichtbarer Menüpunkt
	
	str_target_invitation = "org_admin_detail.asp?btnSub=N"
	str_titel_invitation = fc_value_string(Session("ses_i_language"), "var_main_m_24")'"Einladungsprofil Abteilungen bearbeiten"
	str_caption_invitation = fc_value_string(Session("ses_i_language"), "var_main_m_19")'"Einladung Abteilungen"

	str_target_invitation_ov = "org_admin_all.asp"
	str_titel_invitation_ov = fc_value_string(Session("ses_i_language"), "var_main_m_25")'"Übersicht Abteilungen"
	str_caption_invitation_ov = fc_value_string(Session("ses_i_language"), "var_main_m_25")'"Übersicht Abteilungen"

	str_target_overview = "trainer_admin_all.asp"
	str_titel_overview = fc_value_string(Session("ses_i_language"), "var_main_m_26")'"Übersicht Trainer"
	str_caption_overview = fc_value_string(Session("ses_i_language"), "var_main_m_26")'"Übersicht Trainer"

'status RPT	
	str_target_status_rpt = "admin_overview_status.asp"
	str_titel_status_rpt = fc_value_string(Session("ses_i_language"), "var_main_m_27")'"Status-Report"
	str_caption_status_rpt = fc_value_string(Session("ses_i_language"), "var_main_m_27")'"Status-Report"

'admin RPT	
	str_target_admin_rpt = "admin_overview_id.asp"
	str_titel_admin_rpt = fc_value_string(Session("ses_i_language"), "var_main_m_28")'"Admin-Report"
	str_caption_admin_rpt = fc_value_string(Session("ses_i_language"), "var_main_m_28")'"Admin-Report"
end if

'Admin einer Abteilung Typ A
If Cint(lng_fk_user_group_ses) = 3 and Cint(iu) > 0 and i_dummy_head_org = 0 Then

	str_target_userprofil = "org_user_admin_detail.asp"
	str_titel_userprofil = fc_value_string(Session("ses_i_language"), "var_main_m_23")'"Benutzer-Profil bearbeiten"
	str_caption_userprofil = fc_value_string(Session("ses_i_language"), "var_main_m_13")
	
	'ok
	str_target_invitation = "trainer_admin_detail.asp?btnSub=N"
	str_titel_invitation = fc_value_string(Session("ses_i_language"), "var_main_m_29")'"Einladung Trainer/Betreuer"
	str_caption_invitation = fc_value_string(Session("ses_i_language"), "var_main_m_21")
	
	str_target_invitation_ov = "trainer_admin_all.asp"
	str_titel_invitation_ov = fc_value_string(Session("ses_i_language"), "var_main_m_20")'"Übersicht Trainer/Betreuer"
	str_caption_invitation_ov = fc_value_string(Session("ses_i_language"), "var_main_m_20")'"Übersicht Trainer/Betreuer"
	
'wäre gedacht für eine übersicht >> Übersicht Junior-Athleten
'		str_target_overview = "trainer_admin_all.asp"
'		str_titel_overview = fc_value_string(Session("ses_i_language"), "var_main_m_26")'"Übersicht Trainer"
'		str_caption_overview = fc_value_string(Session("ses_i_language"), "var_main_m_26")'"Übersicht Trainer"

	
'status RPT	
	str_target_status_rpt = "admin_overview_status.asp"
	str_titel_status_rpt = fc_value_string(Session("ses_i_language"), "var_main_m_27")'"Status-Report"
	str_caption_status_rpt = fc_value_string(Session("ses_i_language"), "var_main_m_27")'"Status-Report"
end if

'trainer
If Cint(lng_fk_user_group_ses) = 4 and Cint(iu) > 0 Then

	str_target_userprofil = "trainer_user_admin_detail.asp"
	str_titel_userprofil = fc_value_string(Session("ses_i_language"), "var_main_m_23")'"Benutzer-Profil bearbeiten"
	str_caption_userprofil = fc_value_string(Session("ses_i_language"), "var_main_m_13")
	
	str_target_invitation = "athlete_admin_detail.asp?btnSub=N"
	str_titel_invitation = fc_value_string(Session("ses_i_language"), "var_main_m_22")'"Einladung Junior-Athleten"
	str_caption_invitation = fc_value_string(Session("ses_i_language"), "var_main_m_22")'Einladung Junior-Athleten

	str_target_invitation_ov = "athlete_admin_all.asp"
	str_titel_invitation_ov = fc_value_string(Session("ses_i_language"), "var_main_m_31")'"Übersicht Trainer/Betreuer"
	str_caption_invitation_ov = fc_value_string(Session("ses_i_language"), "var_main_m_31")'"Übersicht Trainer/Betreuer"
	
'wäre gedacht für eine übersicht >> Übersicht Junior-Athleten
'		str_target_overview = "trainer_admin_all.asp"
'		str_titel_overview = fc_value_string(Session("ses_i_language"), "var_main_m_26")'"Übersicht Trainer"
'		str_caption_overview = fc_value_string(Session("ses_i_language"), "var_main_m_26")'"Übersicht Trainer"

'status RPT	
	str_target_status_rpt = "admin_overview_status.asp"
	str_titel_status_rpt = fc_value_string(Session("ses_i_language"), "var_main_m_27")'"Status-Report"
	str_caption_status_rpt = fc_value_string(Session("ses_i_language"), "var_main_m_27")'"Status-Report"
end if

'athleten
If Cint(lng_fk_user_group_ses) = 5 and Cint(iu) > 0 Then

'--------------------------------------------------------------------------
'2012 12 25 variable die die Schaltfläche zum anzeigen des Konsolidierten Wert anzeigt
'1= alles normal - alles wird abgespeichert
'2= der Konsolidierten Wert wird angezeigt - ohne das die Eingabe abgespeichert wird
'x_translate_function
Dim sql_tmp_konsolidierter_wert
Dim rst_tmp_konsolidierter_wert
Dim i_konsolidierter_wert
Dim str_konsolidierter_wert
sql_tmp_konsolidierter_wert = "SELECT lng_k_function FROM x_translate_function WHERE id_k_lng = '2'"
'Response.Write(sql_tmp_konsolidierter_wert)
'Response.End()

Set rst_tmp_konsolidierter_wert = Server.CreateObject("ADODB.Recordset")
rst_tmp_konsolidierter_wert.Open sql_tmp_konsolidierter_wert, objConn, adOpenStatic, adLockReadOnly   
 	If Not rst_tmp_konsolidierter_wert.EOF Then
        i_konsolidierter_wert= rst_tmp_konsolidierter_wert.Fields("lng_k_function").Value
    End if
	rst_tmp_konsolidierter_wert.Close
set rst_tmp_konsolidierter_wert = Nothing

If IsNull(i_konsolidierter_wert) or IsEmpty(i_konsolidierter_wert) or Len(i_konsolidierter_wert)=0 Then
	i_konsolidierter_wert = 1
end if

'Response.Write("i_konsolidierter_wert =" & i_konsolidierter_wert & "<br>")
'--------------------------------------------------------------------------
	str_target_userprofil = "athlete_user_admin_detail.asp"
	str_titel_userprofil = fc_value_string(Session("ses_i_language"), "var_main_m_23")'"Benutzer-Profil bearbeiten"
	str_caption_userprofil = fc_value_string(Session("ses_i_language"), "var_main_m_13")
	
	str_target_invitation = "athlete_authorizations.asp"
	str_titel_invitation = fc_value_string(Session("ses_i_language"), "var_main_m_15")
	str_caption_invitation = fc_value_string(Session("ses_i_language"), "var_main_m_15")
	
	If Cint(i_konsolidierter_wert) = 1 Then'athlete_measured_data.asp
		str_target_measured = "athlete_measured_data.asp"
	end if
	If Cint(i_konsolidierter_wert) = 2 Then'athlete_measured_data_01.asp >> für Hans
		str_target_measured = "athlete_measured_data_01.asp"
	end if
	
	str_titel_measured = fc_value_string(Session("ses_i_language"), "var_main_m_17")
	str_caption_measured = fc_value_string(Session("ses_i_language"), "var_main_m_17")
	

'2011 07 28 entscheidet ob der athlet eine info oder seine grafik sieht
'******************************************************************************
'20110 728
' überprüft ob der user auf eine Infoseite statt seiner Grafik sieht
' InputParameter:
' ID ... user id des athleten 
'******************************************************************************
'Function fc_i_route_info_site(ID)

	If fc_i_route_info_site(iu) = 1 Then
		str_target_graphic = "analysis-onhold.asp?lng_id=1"
	else
		str_target_graphic = "analysis.asp?lng=1"		
	end if
	'str_target_graphic = "analysis.asp?lng_id=1"
	
	str_titel_graphic = fc_value_string(Session("ses_i_language"), "var_main_m_18")
	str_caption_graphic = fc_value_string(Session("ses_i_language"), "var_main_m_18")
end if

'Typ B ---------------------------------------------------------------------------------
'Admin einer Org	
If Cint(lng_fk_user_group_ses) = 3 and Cint(iu) > 0 and Cint(i_dummy_head_org) = 1 Then
	str_target_userprofil = "org_user_admin_detail.asp"
	str_titel_userprofil = fc_value_string(Session("ses_i_language"), "var_main_m_23")'"Benutzer-Profil bearbeiten"
	str_caption_userprofil = fc_value_string(Session("ses_i_language"), "var_main_m_13")
	
	str_target_invitation = "trainer_admin_all.asp"
	str_titel_invitation = fc_value_string(Session("ses_i_language"), "var_main_m_29")'"Einladungsprofil Trainer bearbeiten"
	str_caption_invitation = fc_value_string(Session("ses_i_language"), "var_main_m_21")

'status RPT	
	str_target_status_rpt = "admin_overview_status.asp"
	str_titel_status_rpt = fc_value_string(Session("ses_i_language"), "var_main_m_27")'"Status-Report"
	str_caption_status_rpt = fc_value_string(Session("ses_i_language"), "var_main_m_27")'"Status-Report"
end if
'usergroup
'Session("ses_i_usergroup")
'1	SuperVisor	SV 	Admin All
'2	Head Org	HO 	Head Org Admin
'3	Org			OR	Org Admin oder Abteilungsadmin
'4	Trainer		TR	Trainer Admin
'5	Athlete		AT	Athlet Admin
%>           
    
<table width="90%" height="100" border="0">
    <%If Cint(lng_fk_user_group_ses) > 1 and Cint(iu) > 0 Then %>
    <tr>
      <td height="<%=i_height%>" colspan="2" class="txtbasesm"><div align="left"><strong><%= fc_value_string(Session("ses_i_language"), "var_main_m_12") %></strong></div></td>
      </tr>
    <tr>
      <td width="6%" height="<%=i_height%>"><div align="left"></div></td>
      <td width="94%" height="<%=i_height%>"><div align="left"><a href="<%= str_target_userprofil %>" title="<%= str_titel_userprofil %>" class="txtbasesm"><%= str_caption_userprofil %></a></div></td>
      </tr>
    <tr>
      <td height="5"><div align="left"></div></td>
      <td height="5"><div align="left"></div></td>
      </tr>
    <% end if %>
    <tr>
      <td height="<%=i_height%>" colspan="2" class="txtbasesm"><div align="left"><strong><%= fc_value_string(Session("ses_i_language"), "var_main_m_05") %></strong></div></td>
      </tr>
<%If Cint(lng_fk_user_group_ses) > 1 and Cint(iu) > 0 Then'normalerweise einladungsseite ... ausser beim athleten ist es Authorization %>
    <tr>
      <td height="<%=i_height%>"><div align="left"></div></td>
      <td height="<%=i_height%>"><div align="left"><a href="<%= str_target_invitation %>" title="<%= str_titel_invitation %>" class="txtbasesm"><%= str_caption_invitation %></a></div></td>
    </tr>
    
	<% If Session("ses_i_usergroup") < 5 Then'alle admin ... von Typ A bis Typ C %>
    <tr>
      <td height="<%=i_height%>"><div align="left"></div></td>
      <td height="<%=i_height%>"><div align="left"><a href="<%= str_target_invitation_ov %>" title="<%= str_titel_invitation_ov %>" class="txtbasesm"><%= str_caption_invitation_ov %></a></div></td>
      </tr>
    <tr>
      <td height="<%=i_height%>">&nbsp;</td>
      <td height="<%=i_height%>"><div align="left"><a href="<%= str_target_overview %>" title="<%= str_titel_overview %>" class="txtbasesm"><%= str_caption_overview %></a></div></td>
      </tr>
    <% end if %>
    
    <% If i_report_01 = 1 Then %>
    <tr>
      <td height="<%=i_height%>"><div align="left"></div></td>
      <td height="<%=i_height%>"><div align="left"><a href="<%= str_target_status_rpt %>" title="<%= str_titel_status_rpt %>" class="txtbasesm"><%= str_caption_status_rpt %></a></div></td>
      </tr>
    <% end if %>
    
    <% If i_report_02 = 1 Then %>
    <tr>
      <td height="<%=i_height%>"><div align="left"></div></td>
      <td height="<%=i_height%>"><div align="left"><a href="<%= str_target_admin_rpt %>" title="<%= str_titel_admin_rpt %>" class="txtbasesm"><%= str_caption_admin_rpt %></a></div></td>
      </tr>
    <% end if %>
    
<% end if'If Cint(lng_fk_user_group_ses) > 1 and Cint(iu) > 0 Then %>

    <%If Cint(lng_fk_user_group_ses) = 1 and Cint(iu) > 0 Then %>
    <tr>
      <td height="<%=i_height%>"><div align="left"></div></td>
      <td height="<%=i_height%>"><div align="left"><a href="head_org_admin_all.asp" class="txtbasesm"><%= fc_value_string(Session("ses_i_language"), "var_main_m_06") %></a></div></td>
      </tr>
    <tr>
      <td height="<%=i_height%>"><div align="left"></div></td>
      <td height="<%=i_height%>"><div align="left"><a href="org_admin_all.asp" class="txtbasesm"><%= fc_value_string(Session("ses_i_language"), "var_main_m_07") %></a></div></td>
      </tr>
    <tr>
      <td height="<%=i_height%>"><div align="left"></div></td>
      <td height="<%=i_height%>"><div align="left"><a href="trainer_admin_all.asp" class="txtbasesm"><%= fc_value_string(Session("ses_i_language"), "var_main_m_08") %></a></div></td>
      </tr>
    <tr>
      <td height="<%=i_height%>"><div align="left"></div></td>
      <td height="<%=i_height%>"><div align="left"><a href="contact_us_admin.asp" class="txtbasesm"><%= fc_value_string(Session("ses_i_language"), "var_main_m_09") %></a></div></td>
      </tr>
    <tr>
      <td height="<%=i_height%>"><div align="left"></div></td>
      <td height="<%=i_height%>"><div align="left"><a href="admin_overview.asp" class="txtbasesm"><%= fc_value_string(Session("ses_i_language"), "var_main_m_10") %></a></div></td>
      </tr>
    <tr>
      <td height="<%=i_height%>"><div align="left"></div></td>
      <td height="<%=i_height%>"><div align="left"><a href="create_new_account.asp" target="_blank" class="txtbasesm"><%= fc_value_string(Session("ses_i_language"), "var_main_m_11") %></a></div></td>
      </tr>
    <% end if %>
    <tr>
      <td height="<%=i_height%>"><div align="left"></div></td>
      <td height="<%=i_height%>"><div align="left"></div></td>
      </tr>
    <% If Session("ses_i_usergroup") = 5 Then %>
    <tr>
      <td height="<%=i_height%>" colspan="2" class="txtbasesm"><div align="left"><strong><%= fc_value_string(Session("ses_i_language"), "var_main_m_16") %></strong></div></td>
      </tr>
    <tr>
      <td height="<%=i_height%>"><div align="left"></div></td><td height="15"><div align="left"><a href="<%= str_target_measured %>" title="<%= str_titel_measured %>" class="txtbasesm"><%= str_caption_measured %></a></div></td>
      </tr>
    <tr>
      <td height="<%=i_height%>"><div align="left"></div></td>
      <td height="<%=i_height%>"><div align="left"><a href="<%= str_target_graphic %>"  target="_blank" class="txtbasesm"><%= str_caption_graphic %></a></div></td>
      </tr>
    <% end if %>
    <tr>
      <td height="<%=i_height%>"><div align="left"></div></td>
      <td height="<%=i_height%>"><div align="left"></div></td>
      </tr>
  </table>
  
</div></td>
<td width="149" height="360" align="left" valign="top"><div class="txtbasesm"><%= fc_value_string(Session("ses_i_language"), "var_main_m_01") %></div><br />
<br />
</td>
<td width="149" height="360" align="left" valign="top"><div class="txtbasesm"><%= fc_value_string(Session("ses_i_language"), "var_main_m_02") %></div></td>
<td width="149" height="360" align="left" valign="top"><div class="txtbasesm Stil7"><%= fc_value_string(Session("ses_i_language"), "var_main_m_03") %></div><br />
  <br />
</td>
<td width="149" height="360" align="left" valign="top"><div class="txtbasesm"><%= fc_value_string(Session("ses_i_language"), "var_main_m_04") %></div><br />
<br />
</td>
<td width="26" height="360">&nbsp;</td>
</tr>
</table>
</td>



        <!-- InstanceEndEditable -->
<td width="25" valign="top">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td width="950" height="71" valign="bottom" background="<%= fc_value_string(Session("ses_i_language"), "var_glob_bitm_21") %>" class="txtlegal"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="230">&nbsp;</td>
<td height="24" align="left" valign="top" class="txtsm11">
<table width="100%" border="0">
<tr>
<td width="84%" height="35" valign="top"><span class="txtlegal"><a href="contact_us.asp"><%= fc_value_string(Session("ses_i_language"), "var_glob_txt_07") %></a> | <a href="about.asp"><%= fc_value_string(Session("ses_i_language"), "var_glob_txt_08") %></a> | <a href="terms.asp"><%= fc_value_string(Session("ses_i_language"), "var_glob_txt_09") %></a> | <a href="terms.asp#disclaimer"><%= fc_value_string(Session("ses_i_language"), "var_glob_txt_10") %></a> | <a href="terms.asp#privacy"><%= fc_value_string(Session("ses_i_language"), "var_glob_txt_11") %></a> | </span>
<% If Session("ses_i_language") = 2 Then %>
<input name="btnSublanguage" type="image" onClick="javascript: change_language(1)" value="lang01" src="../App/images/country/flag_germany.png" align="middle" width="16" height="16" vspace="1" border="0"/>
<% end if %>
<% If Session("ses_i_language") = 1 Then %>
<input name="btnSublanguage" type="image" onclick="javascript: change_language(2)" value="lang02" src="../App/images/country/flag_usa.png" align="middle" width="16" height="16" vspace="1" border="0"/>
<% end if %>     
</td>
<td width="5%" height="35" valign="top">&nbsp;</td>
<td width="5%" height="35" valign="top">&nbsp;</td>
<td width="6%" height="35" valign="top">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
</table>
<!--#include file="change_pw.html"-->
</body>
<!-- InstanceEnd --></html>
<%
If Err.Number <> 0 Then
	Response.Write(Err.Description)
	Err.Clear
End If
%>